import java.io.*;
import java.net.*;

public class Client2 {
    public static void main(String[] args) throws IOException {
        Socket sk=new Socket("127.0.0.1",12346);
        InputStream in=sk.getInputStream();
        OutputStream out= sk.getOutputStream();

        InputStreamReader ir=new InputStreamReader(in);
        OutputStreamWriter ow=new OutputStreamWriter(out);

        BufferedReader br=new BufferedReader(ir);
        BufferedWriter bw=new BufferedWriter(ow);
        InputStreamReader ik=new InputStreamReader(System.in);
        BufferedReader kr=new BufferedReader(ik);

        String s1,s2;
        do{
            s1=br.readLine();
            System.out.println("我说： "+s1);

            s1=kr.readLine();
            bw.write(s1);
            bw.newLine();
            bw.flush();

            s2=br.readLine();
            System.out.print("对方说  "+s2);
        }while(!s1.equals("Bye"));
        sk.close();
    }
}
